<template>
  <WSchedule :planList="timePeriodList" :isFirstDayOfMondayOrSunday="1" :hasNumExpend="1" @handleDetail="handleDetail"
    @handleCardDetail="handleCardDetail" @changeWeek="changeWeek">
    <template v-slot:thing="{ row }">
      <span>{{ row.content }}</span>
      <span>{{ row.timePeriod }}</span>
    </template>
  </WSchedule>
</template>
<script>
import { SortUp } from "@element-plus/icons-vue";
import axios from "axios";
import WSchedule from "@/components/weekScheduleCom/weekScheduleCom.vue";
import userCount from "@/stores/userCount";
export default {
  components: {
    WSchedule,
  },
  beforeCreate() {

  },
  created() {
    axios.post(`api/content//todo/${this.userId}`).then((res) => {
      console.log(res.data);
      // res.data.forEach((element) => {
      //   element.startDate.slice(11, 13);
      //   console.log(element);
      // });
      for (let i = 0; i < res.data.length; i++) {
        let content = res.data[i].content;
        let date = res.data[i].startDate.slice(0, 10);
        let timePeriod =
          res.data[i].startDate.slice(11, 16) +
          "-" +
          res.data[i].endDate.slice(11, 16);
        let place = res.data[i].address;
        let status = res.data[i].status;
        let partner = res.data[i].partner;
        switch (res.data[i].startDate.slice(11, 13)) {
          case "00":
            console.log(date);
            if (this.timePeriodList[0].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[0].schedule.length; j++) {
                if (this.timePeriodList[0].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[0].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[0].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[0].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "01":
            console.log(date);
            if (this.timePeriodList[1].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[1].schedule.length; j++) {
                if (this.timePeriodList[1].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[1].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[1].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[1].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "02":
            console.log(date);
            if (this.timePeriodList[2].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[2].schedule.length; j++) {
                if (this.timePeriodList[2].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[2].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[2].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[2].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "03":
            console.log(date);
            if (this.timePeriodList[3].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[3].schedule.length; j++) {
                if (this.timePeriodList[3].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[3].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[3].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[3].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "04":
            console.log(date);
            if (this.timePeriodList[4].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[4].schedule.length; j++) {
                if (this.timePeriodList[4].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[4].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[4].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[4].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: "测试地点",
                    status: 2,
                    timePeriod: timePeriod,
                    watchman: "tester",
                  },
                ],
              });
            }
            break;
          case "05":
            console.log(date);
            if (this.timePeriodList[5].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[5].schedule.length; j++) {
                if (this.timePeriodList[5].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[5].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[5].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[5].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: "测试地点",
                    status: 2,
                    timePeriod: timePeriod,
                    watchman: "tester",
                  },
                ],
              });
            }
            break;
          case "06":
            console.log(date);
            if (this.timePeriodList[6].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[6].schedule.length; j++) {
                if (this.timePeriodList[6].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[6].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[6].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[6].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: "测试地点",
                    status: 2,
                    timePeriod: timePeriod,
                    watchman: "tester",
                  },
                ],
              });
            }
            break;
          case "07":
            console.log(date);
            if (this.timePeriodList[7].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[7].schedule.length; j++) {
                if (this.timePeriodList[7].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[7].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[7].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[7].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: "测试地点",
                    status: 2,
                    timePeriod: timePeriod,
                    watchman: "tester",
                  },
                ],
              });
            }
            break;
          case "08":
            console.log(date);
            if (this.timePeriodList[8].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[8].schedule.length; j++) {
                if (this.timePeriodList[8].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[8].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[8].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[8].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "09":
            console.log(date);
            if (this.timePeriodList[9].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[9].schedule.length; j++) {
                if (this.timePeriodList[9].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[9].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[9].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[9].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: "测试地点",
                    status: 2,
                    timePeriod: timePeriod,
                    watchman: "tester",
                  },
                ],
              });
            }
            break;
          case "10":
            console.log(date);
            if (this.timePeriodList[10].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[10].schedule.length;
                j++
              ) {
                if (this.timePeriodList[10].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[10].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[10].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[10].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "11":
            console.log(date);
            if (this.timePeriodList[11].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[11].schedule.length;
                j++
              ) {
                if (this.timePeriodList[11].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[11].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[11].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[11].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "12":
            console.log(date);
            if (this.timePeriodList[12].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[12].schedule.length;
                j++
              ) {
                if (this.timePeriodList[12].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[12].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[12].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[12].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "13":
            console.log(date);
            if (this.timePeriodList[13].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[13].schedule.length;
                j++
              ) {
                if (this.timePeriodList[13].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[13].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[13].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[13].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "14":
            console.log(date);
            if (this.timePeriodList[14].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[14].schedule.length;
                j++
              ) {
                if (this.timePeriodList[14].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[14].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[14].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[14].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "15":
            console.log(date);
            if (this.timePeriodList[15].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[15].schedule.length;
                j++
              ) {
                if (this.timePeriodList[15].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[15].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[15].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[15].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "16":
            console.log(date);
            if (this.timePeriodList[16].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[16].schedule.length;
                j++
              ) {
                console.log(this.timePeriodList[16].schedule.length);
                console.log(this.timePeriodList[16].schedule);
                // console.log(this.timePeriodList[16].schedule[0]["2022-12-18"]);
                // console.log(this.timePeriodList[16].schedule[0][date]);
                console.log(this.timePeriodList[16].schedule[j]);
                if (this.timePeriodList[16].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[16].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[16].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: "测试地点",
                        status: 2,
                        timePeriod: timePeriod,
                        watchman: "tester",
                      },
                    ],
                  });
                  break;
                }

                // if(this.timePeriodList[16].schedule[j][date].length > 0) {
                //   if(this.timePeriodList[16].schedule[j][date][0].date === date) {}
                // }
                // if (
                //   this.timePeriodList[16].schedule[j][date][0].length > 0 &&
                //   this.timePeriodList[16].schedule[j][date][0].date === date
                // ) {
                //   console.log("有么有");
                //   this.timePeriodList[16].schedule[j][date].push({
                //     content: content,
                //     date: date,
                //     place: "测试地点",
                //     status: 2,
                //     timePeriod: timePeriod,
                //     watchman: "tester",
                //   });
                // } else {
                //   console.log("ggg");
                //   this.timePeriodList[16].schedule.push({
                //     isExpend: false,
                //     [date]: [
                //       {
                //         content: content,
                //         date: date,
                //         place: "测试地点",
                //         status: 2,
                //         timePeriod: timePeriod,
                //         watchman: "tester",
                //       },
                //     ],
                //   });
                //   break;
                // }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[16].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "17":
            console.log(date);
            if (this.timePeriodList[17].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[17].schedule.length;
                j++
              ) {
                if (this.timePeriodList[17].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[17].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[17].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[17].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "18":
            console.log(date);
            if (this.timePeriodList[18].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[18].schedule.length;
                j++
              ) {
                if (this.timePeriodList[18].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[18].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[18].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[18].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "19":
            console.log(date);
            if (this.timePeriodList[19].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[19].schedule.length;
                j++
              ) {
                if (this.timePeriodList[19].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[19].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[19].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[19].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "20":
            console.log(date);
            if (this.timePeriodList[20].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[20].schedule.length;
                j++
              ) {
                if (this.timePeriodList[20].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[20].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[20].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[20].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "21":
            console.log(date);
            if (this.timePeriodList[21].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[21].schedule.length;
                j++
              ) {
                if (this.timePeriodList[21].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[21].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[21].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[21].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "22":
            console.log(date);
            if (this.timePeriodList[22].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[22].schedule.length;
                j++
              ) {
                if (this.timePeriodList[22].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[22].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[22].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[22].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
          case "23":
            console.log(date);
            if (this.timePeriodList[23].schedule.length > 0) {
              for (
                let j = 0;
                j < this.timePeriodList[23].schedule.length;
                j++
              ) {
                if (this.timePeriodList[23].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[23].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[23].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[23].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
            console.log(date);
            if (this.timePeriodList[0].schedule.length > 0) {
              for (let j = 0; j < this.timePeriodList[0].schedule.length; j++) {
                if (this.timePeriodList[0].schedule[j].hasOwnProperty(date)) {
                  console.log("能不能出来");
                  this.timePeriodList[0].schedule[j][date].push({
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  });
                } else {
                  console.log("ggg");
                  this.timePeriodList[16].schedule.push({
                    isExpend: false,
                    [date]: [
                      {
                        content: content,
                        date: date,
                        place: place,
                        status: status,
                        timePeriod: timePeriod,
                        watchman: partner,
                      },
                    ],
                  });
                  break;
                }
              }
            } else {
              console.log("hhh");
              this.timePeriodList[0].schedule.push({
                isExpend: false,
                [date]: [
                  {
                    content: content,
                    date: date,
                    place: place,
                    status: status,
                    timePeriod: timePeriod,
                    watchman: partner,
                  },
                ],
              });
            }
            break;
        }
        // if (res.data[i].startDate.slice(11, 13) === "16") {
        //   let date = res.data[i].startDate.slice(0, 10);
        //   console.log(date);
        //   // this.timePeriodList[16]
        //   console.log(this.timePeriodList[16]);
        //   this.timePeriodList[16].schedule.push({
        //     isExpend: false,
        //     [date]: [
        //       {
        //         content: "testing",
        //         date: date,
        //         place: "测试地点",
        //         status: 2,
        //         timePeriod: "12:00~14:00",
        //         watchman: "tester",
        //       },
        //     ],
        //   });
        //   console.log(res.data[i]);
        // }
        // const element = array[i];
      }
      // console.log(this.timePeriodList);
      console.log(this.timePeriodList[8].schedule[0]);
      // this.timePeriodList[8].schedule[0]["2022-12-18"][0].content = "hello";
      // console.log(this.timePeriodList[8].schedule[0]["2022-12-18"][0].content);
      // console.log(this.timePeriodList);
    });
    // console.log("initTodoList:" + this.initTodoList);
  },
  data() {
    var store = userCount();
    let userId = store.userid;
    /**
     * 获取当天时间
     * @returns {string}
     */
    function getCurDay(num = 0) {
      var datetime = new Date();
      var year = datetime.getFullYear();
      var month =
        datetime.getMonth() + 1 < 10
          ? "0" + (datetime.getMonth() + 1)
          : datetime.getMonth() + 1;
      let day = datetime.getDate();
      if (day + num > 0) {
        day =
          day + num < 10
            ? "0" + (datetime.getDate() + num)
            : datetime.getDate() + num;
      } else {
        day =
          day - num < 10
            ? "0" + (datetime.getDate() - num)
            : datetime.getDate() - num;
      }
      return `${year}-${month}-${day}`;
    }
    return {
      timePeriodList: [
        {
          timePeriod: "00:00",
          schedule: [],
        },
        {
          timePeriod: "01:00",
          schedule: [],
        },
        {
          timePeriod: "02:00",
          schedule: [],
        },
        {
          timePeriod: "03:00",
          schedule: [],
        },
        {
          timePeriod: "04:00",
          schedule: [],
        },
        {
          timePeriod: "05:00",
          schedule: [],
        },
        {
          timePeriod: "06:00",
          schedule: [],
        },
        {
          timePeriod: "07:00",
          schedule: [],
        },
        {
          timePeriod: "08:00",
          schedule: [
            // {
            //   isExpend: false,
            //   [getCurDay()]: [
            //     {
            //       timePeriod: "8:00~10:00",
            //       date: getCurDay(),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 1,
            //     },
            //     {
            //       timePeriod: "8:00~10:00",
            //       date: getCurDay(),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 2,
            //     },
            //     {
            //       timePeriod: "8:00~10:00",
            //       date: getCurDay(),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 3,
            //     },
            //   ],
            // },
            // {
            //   isExpend: false,
            //   [getCurDay(-1)]: [
            //     {
            //       id: 1,
            //       timePeriod: "8:00~10:00",
            //       date: getCurDay(-1),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 1,
            //     },
            //   ],
            // },
          ],
        },
        {
          timePeriod: "09:00",
          schedule: [],
        },
        {
          timePeriod: "10:00",
          schedule: [],
        },
        {
          timePeriod: "11:00",
          schedule: [],
        },
        {
          timePeriod: "12:00",
          schedule: [
            // {
            //   isExpend: false,
            //   ["2022-12-18"]: [
            //     {
            //       timePeriod: "12:00~14:00",
            //       date: "2022-12-18",
            //       content: "test",
            //       watchman: "tester",
            //       place: "测试地点",
            //       status: 2,
            //     },
            //     {
            //       timePeriod: "12:00~14:00",
            //       date: getCurDay(),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 3,
            //     },
            //   ],
            // },
            // {
            //   isExpend: false,
            //   [getCurDay(-1)]: [
            //     {
            //       timePeriod: "12:00~14:00",
            //       date: getCurDay(-1),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 1,
            //     },
            //     {
            //       timePeriod: "12:00~14:00",
            //       date: getCurDay(-1),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 1,
            //     },
            //     {
            //       timePeriod: "12:00~14:00",
            //       date: getCurDay(-1),
            //       content: "大学英语",
            //       watchman: "井底的蜗牛",
            //       place: "测试地点",
            //       status: 1,
            //     },
            //   ],
            // },
          ],
        },
        {
          timePeriod: "13:00",
          schedule: [],
        },
        {
          timePeriod: "14:00",
          schedule: [],
        },
        {
          timePeriod: "15:00",
          schedule: [],
        },
        {
          timePeriod: "16:00",
          schedule: [],
        },
        {
          timePeriod: "17:00",
          schedule: [],
        },
        {
          timePeriod: "18:00",
          schedule: [],
        },
        {
          timePeriod: "19:00",
          schedule: [],
        },
        {
          timePeriod: "20:00",
          schedule: [],
        },
        {
          timePeriod: "21:00",
          schedule: [],
        },
        {
          timePeriod: "22:00",
          schedule: [],
        },
        {
          timePeriod: "23:00",
          schedule: [],
        },
      ],
      userId: userId,
    };
  },
  methods: {
    /**
     * 点击详情
     * @param row
     */
    handleDetail(row) {
      console.log(row);
    },
    /**
     * 点击卡片查看全部内容
     */
    handleCardDetail(row) {
      console.log(row);
    },
    /**
     * 切换周
     * @param date
     */
    changeWeek(date) {
      console.log(date);
    },
  },
};
</script>
